-
Notifications
You must be signed in to change notification settings - Fork 24
Add Prometheus configMap for k3s #659
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a Prometheus ConfigMap override specifically for k3s environments and updates accompanying documentation.
- Introduces a new Prometheus configMap with custom scrape and relabel configurations for k3s and cAdvisor compatibility.
- Updates the README to document how and why to use this override.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| charts/sourcegraph/examples/prometheus/prometheus-override-k3s.ConfigMap.yaml | New Prometheus override ConfigMap with custom scrape_configs for k3s |
| charts/sourcegraph/examples/prometheus/README.md | Documentation for applying the override ConfigMap |
| - source_labels: [__meta_kubernetes_node_name] | ||
| regex: (.+) | ||
| target_label: __metrics_path__ | ||
| replacement: /api/v1/nodes/${1}/proxy/metrics/cadvisor |
Copilot
AI
Mar 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace '${1}' with '$1' to use the correct capture group syntax in Prometheus replacement patterns.
| replacement: /api/v1/nodes/${1}/proxy/metrics/cadvisor | |
| replacement: /api/v1/nodes/$1/proxy/metrics/cadvisor |
| - source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port] | ||
| action: replace | ||
| regex: (.+):(?:\d+);(\d+) | ||
| replacement: ${1}:${2} |
Copilot
AI
Mar 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace '${1}:${2}' with '$1:$2' to ensure proper capture group referencing in Prometheus replacement patterns.
| replacement: ${1}:${2} | |
| replacement: $1:$2 |
Linear issue: [REL-809: Investigate why Grafana is not showing Prometheus data](https://linear.app/sourcegraph/issue/REL-809/investigate-why-grafana-is-not-showing-prometheus-data) ### Checklist - [x] Follow the [manual testing process](https://github.com/sourcegraph/deploy-sourcegraph-helm/blob/main/TEST.md) - [ ] Update [changelog](https://github.com/sourcegraph/deploy-sourcegraph-helm/blob/main/charts/sourcegraph/CHANGELOG.md) - [ ] Update [Kubernetes update doc](https://docs.sourcegraph.com/admin/updates/kubernetes) ### Test plan Tested with a customer self-hosting on k3s, and on our AMI running k3s <!-- As part of SOC2/GN-104 and SOC2/GN-105 requirements, all pull requests are REQUIRED to provide a "test plan". A test plan is a loose explanation of what you have done or implemented to test this, as outlined in our Testing principles and guidelines: https://docs.sourcegraph.com/dev/background-information/testing_principles Write your test plan here after the "Test plan" header. -->
Linear issue: REL-809: Investigate why Grafana is not showing Prometheus data
Checklist
Test plan
Tested with a customer self-hosting on k3s, and on our AMI running k3s